﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using STX.Domain;
using STX.Service;
namespace STX.Web.Controllers
{
    public class AccountController : BaseController
    {
        public BizUserService BizUserService { get; set; }

        public ActionResult Index()
        {
            var user = User.Identity.Name;
            return View();
        }

        public ActionResult Login()
        {
            return View();
        }

        public ActionResult Register()
        {
            return View();
        }

        [HttpPost]
        public JsonResult Register(STX.Web.Models.Account.RegisterModel dto)
        {
            var model = new BizUser
            {
                Email = dto.EMail,
                LastLoginIp = "",
                LastLoginTime = DateTime.Now,
                Photo = "",
                Password = dto.PassWord,
                Username = dto.UserName,
                RegDateTime = DateTime.Now,
                LoginCount = 0,
                Status = BizUser.BizUserStatus.Online
            };
            BizUserService.Add(model);
            return new JsonResult { Data = new { success = true } };
        }

    }

}
